package com.mytest.controller;
import com.mytest.service.HomeService;
import com.mytest.service.MyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HomeController {

    private static final Logger logger = LoggerFactory.getLogger(HomeController.class);

    @Autowired
    HomeService homeService;
    @Autowired
    MyService myService;

    @PostMapping("/method")
    public String method(String string){

        logger.info("controller method");

        return "ok";
    }

    @GetMapping("/method1")
    public String method1(@RequestParam("param")String string){

        logger.info("controller method1");
        homeService.method1(string);

        return "ok1";
    }

    @GetMapping("/method2")
    public String method2(@RequestParam("param")String string){

        logger.info("controller method2");
        homeService.method2(string);
        return "ok2";
    }

    @GetMapping("/method3")
    public String method3(@RequestParam("param")String string){

        logger.info("controller method3");
        homeService.method(string);

        return "ok3";
    }

    @GetMapping("/method4")
    public String method4(@RequestParam("param")String string){

        logger.info("controller method4");
        myService.method(string);

        return "ok4";
    }
}
